{extend name="base2" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class=""><a href="{:url('/admin/custm_svc/index')}">查看海草账号</a></li>
            <li class="layui-this">批量添加海草账号</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" action="{:url('admin/custm_svc/saveFasion')}" method="post">


                    <div class="layui-form-item">
                        <label class="layui-form-label">账号前缀</label>
                        <div class="layui-input-block">
                            <input type="text" name="hrefeer"  required  lay-verify="required" placeholder="请输入账号前缀" class="layui-input wx_hrefeer">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">起始编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="hfrom"  placeholder="请输入起始编号" class="layui-input wx_hfrom">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">微信号</label>
                        <div class="layui-input-block">
                            <textarea name="wechat"  placeholder="微信号" class="layui-textarea wx_hreply1"></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">离线回复</label>
                        <div class="layui-input-block">
                            <textarea name="hreply2"  placeholder="离线回复" class="layui-textarea wx_hreply2"></textarea>
                        </div>
                    </div>
                    <div id="typetwo" >
                        <div id="onlywechat">
                            <div class="layui-form-item">
                                <label class="layui-form-label">二维码</label>
                                <div class="layui-input-block">
                                    <button type="button" id="hfsion" class="layui-btn">上传二维码</button>
                                    <div id="photo-container"></div>
                                </div>
                            </div>
                        </div>
                        </div>


                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-block">
                            <input type="text" name="passwd" value="0" required  lay-verify="required" class="layui-input wx_passwd">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <input type="text" name="remark"  placeholder="请输入备注" class="layui-input wx_remark">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="*">保存</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script src="__JS__/kindeditor/kindeditor.config.js"></script>
<script src="__JS__/kindeditor/kindeditor-all-min.js"></script>
{/block}
{block name="script"}
<script>
 $(function () {
     $('#hfsion').click(function () {
         var fileIput = document.createElement('input')
         fileIput.setAttribute('type', 'file')
         fileIput.setAttribute('multiple', 'multiple')
         fileIput.click()
         fileIput.onchange = function () {
            var files = this.files;
            var arr = [];
            (function _hupload(index) {
                if(index == files.length) {
                    console.log('上传完成')
                    console.log(arr)
                    return
                }
                var data = new FormData()
                data.append('single_img', files[index])
                $.ajax({
                    url: '/api/upload/qrcode',
                    type: 'POST',
                    cache: false,
                    data: data,
                    processData: false,
                    contentType: false,
                    dataType: "json",
                    success: function (res) {
                        arr.push(res)
                        _hupload(index+1)
                    }
                })
            })(0)
         }
     })
 })
</script>
{/block}